package com.ldp.designpatterns.study.factory.abstractFactory;


import com.ldp.designpatterns.study.factory.abstractFactory.factory.AmericanCoffeeFactory;
import com.ldp.designpatterns.study.factory.abstractFactory.factory.CoffeeFactory;
import com.ldp.designpatterns.study.factory.abstractFactory.factory.LatterCoffeFactory;
import com.ldp.designpatterns.study.factory.abstractFactory.service.Coffee;
import com.ldp.designpatterns.study.factory.abstractFactory.service.Color;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @ClassName MethodFactoryDemo
 * @Description 抽象工厂模式——步骤 4:使用该工厂，通过传递类型信息来获取实体类的对象
 * @Author lindipei
 * @Date 2023/10/13 11:09
 */
public class AbstractFactoryDemo {

    @Autowired
    static CoffeeFactory coffeeFactory;

    public static void main(String[] args) {
        Coffee americanCoffee = new AmericanCoffeeFactory().getCoffee();
        americanCoffee.addsugar();
        Color redColor = new AmericanCoffeeFactory().getColor();
        redColor.color();

        Coffee latteCoffee = new LatterCoffeFactory().getCoffee();
        latteCoffee.addsugar();
        Color blackColor = new LatterCoffeFactory().getColor();
        blackColor.color();
    }
}
